<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>title</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<style>
			header {
				height: 50px;
				background-color: #6AB494;
			}
			.back-btn {
				width: 50px;
				height: 50px;
				background-image: url(../image/btn_back.png);
				background-position: center center;
				background-size: 35px 32px;
				background-repeat: no-repeat;
			}
		</style>
	</head>
	<body>
		<header>
			<div class="back-btn" onclick="back()"></div>
		</header>
	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript">
		apiready = function() {
			$api.fixStatusBar($api.dom('header'));
			api.showProgress({
            });
			openCityList();
		};
		function openCityList() {
			var UICityList = api.require('UICityList');
			var y = $api.offset($api.dom('header')).h;
			UICityList.open({
				rect : {
					x : 0,
					y : y,
					w : api.frameWidth,
					h : api.frameHeight - y
				},
				resource : 'widget://res/cityList.json',
				styles : {
					searchBar : {
						bgColor : '#696969',
						cancelColor : '#E3E3E3'
					},
					location : {
						color : '#696969',
						size : 12
					},
					sectionTitle : {
						bgColor : '#eee',
						color : '#000',
						size : 12
					},
					item : {
						bgColor : '#fff',
						activeBgColor : '#696969',
						color : '#000',
						size : 14,
						height : 40
					},
					indicator : {
						bgColor : '#fff',
						color : '#696969'
					}
				},
				currentCity : '北京',
				locationWay : 'GPS',
				hotTitle : '热门城市',
				placeholder : '输入城市名或首字母查询'
			}, function(ret, err) {
				if (ret) {
					if (ret.eventType == 'show') {
						api.hideProgress();
					}
					if (ret.eventType == 'selected') {
						var city = ret.cityInfo.city;
						$api.setStorage("city",city);
						api.execScript({
							name : 'root',
							script : 'changeCity();'
						});
						api.closeWin();
					}
				} else {
					alert(JSON.stringify(err));
				}
			});
		}

		function back() {
			api.closeWin();
		}
	</script>
</html>